package com.yowasa.xiuxian.engine.travel.adventure;

import com.google.common.collect.Sets;
import com.yowasa.xiuxian.engine.travel.AdventureInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.MapEnum;
import com.yowasa.xiuxian.service.helper.UserHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class CuoTuoSuiYue implements AdventureInterface {

    @Autowired
    private UserHelper userHelper;

    @Override
    public Set<MapEnum> limitMaps() {
        return Sets.newHashSet(MapEnum.JUE_YUN_JIAN,MapEnum.PU_GONG_YING_HAI);
    }


    @Override
    public String exec(UserBO user) {

        int num = RandomUtil.randomInt(200, 500) * user.getUserAttr().getUnd() / 25;
        user.getUserConfig().setTravel(user.getUserConfig().getTravel() + num);

        userHelper.lockUser(user,30,user.getName()+"正在秘境探索中");
        return "秘境的风景让你眼花缭乱，不知不觉沉浸其中，仿佛误入了梦幻仙境，当你回过神来之时，一个月已经过去了\n你大开眼界，收获了"+num+"点历练值";
    }


    public boolean isConflict() {
        return true;
    }

    public int weight() {
        return 4;
    }

}